CONTENTS | INDEX | PREV | NEXT
 tmpfile

 NAME
  tmpfile - create a temporary file

 SYNOPSIS
  #include <stdio.h>

  FILE *fp = tmpfile(void);

 FUNCTION
  The tmpfile() call creates a temporary file and returns a
  file pointer.  The name of the file is not accessable.  The
  file pointer is available or reading, writing, and seeking (as in
  rewind, fseek).  The file is initially empty.

  This call may be used to create a temporary file that will
  automatically be remove()d when you fclose() it.  tmpfile() returns
  a FILE * pointer or NULL if it was unable to create the file.

 EXAMPLE
  #include <stdio.h>
  #include <assert.h>

  main()
  {
      FILE *fp = tmpfile();
      char buf[256];

      assert(fp);

      fputs("This is a test ofn"
        "a temporary filen"
        "fubar bletchn",
        fp
      );
      rewind(fp);
      while (fgets(buf, sizeof(buf), fp)) {
      fputs(buf, stdout);
      }
      fclose(fp);     /*  close and delete the file   */
      return(0);
  }

 INPUTS
  none

 RESULTS
  FILE *fp;       openned temporary file

 SEE ALSO
  tmpnam, fopen, fclose